clear
***********************************************
*yield2y MPU
use "./data/yield2y_country_mpu_estimates", clear

*Create 90% CIs
gen ci_low = estimate - 1.645*stderr
gen ci_hi  = estimate + 1.645*stderr

sort estimate

sum yield2y_mpu_full_pooled
local yield2y_mpu_full_pooled = r(mean)

sum yield2y_mpu_full_adv
local yield2y_mpu_full_adv = r(mean)

sum yield2y_mpu_full_eme
local yield2y_mpu_full_eme = r(mean)

gen obsno = _n

labmask obsno, values(Country_Code) 

twoway (rcap ci_low ci_hi obsno if advanced==1, color(red)) (scatter estimate obsno if advanced==1, msymbol(D) mcolor(red)) ///
	   (rcap ci_low ci_hi obsno if advanced==0, color(blue)) (scatter estimate obsno if advanced==0, msymbol(X) mcolor(blue)), ///
 xlabel(1(1)30,valuelabel angle(ninety)) legend(order(2 "Advanced" 4 "EME")) ///
xtitle(" ") yline(`yield2y_mpu_full_pooled', lcolor(black) lwidth(thin) lpattern(dash_3dot)) ///
yline(`yield2y_mpu_full_adv', lcolor(red) lwidth(thin) lpattern(dash)) yline(`yield2y_mpu_full_eme', lcolor(blue) lwidth(thin) lpattern(longdash)) ///
ylabel(,nogrid) yline(0,lcolor(black) lstyle(solid))

graph export "tables\figureA5_panelA.pdf", replace

 ***********************************************
*yield10y MPU
use "./data/yield10y_country_mpu_estimates", clear

*Create 90% CIs
gen ci_low = estimate - 1.645*stderr
gen ci_hi  = estimate + 1.645*stderr

sort estimate

sum yield10y_mpu_full_pooled
local yield10y_mpu_full_pooled = r(mean)

sum yield10y_mpu_full_adv
local yield10y_mpu_full_adv = r(mean)

sum yield10y_mpu_full_eme
local yield10y_mpu_full_eme = r(mean)

gen obsno = _n

labmask obsno, values(Country_Code) 

twoway (rcap ci_low ci_hi obsno if advanced==1, color(red)) (scatter estimate obsno if advanced==1, msymbol(D) mcolor(red)) ///
	   (rcap ci_low ci_hi obsno if advanced==0, color(blue)) (scatter estimate obsno if advanced==0, msymbol(X) mcolor(blue)), ///
 xlabel(1(1)30,valuelabel angle(ninety)) legend(order(2 "Advanced" 4 "EME")) ///
xtitle(" ") yline(`yield10y_mpu_full_pooled', lcolor(black) lwidth(thin) lpattern(dash_3dot)) ///
yline(`yield10y_mpu_full_adv', lcolor(red) lwidth(thin) lpattern(dash)) yline(`yield10y_mpu_full_eme', lcolor(blue) lwidth(thin) lpattern(longdash)) ///
ylabel(,nogrid) yline(0,lcolor(black) lstyle(solid))

graph export "tables\figureA5_panelB.pdf", replace
